home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13410 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  40 lines

  1. Newsgroups: comp.lang.c,comp.unix.programmer
  2. Path: Utrecht.NL.net!news
  3. From: Rene Pijlman <R.W.Pijlman@inter.nl.net>
  4. Subject: Re: tcp/ip woes.
  5. X-Nntp-Posting-Host: asp98-0.amsterdam.nl.net
  6. Message-ID: <DpILL7.Ks1@inter.NL.net>
  7. Sender: news@inter.NL.net (News at newsutr)
  8. Reply-To: R.W.Pijlman@inter.nl.net
  9. Organization: the arrangement of parts so as to form an effective whole
  10. X-Newsreader: skim 0.8.4
  11. References: <4k94gs$nm0@madeline.INS.CWRU.Edu>
  12. Date: Sun, 7 Apr 1996 23:09:45 GMT
  13.  
  14. lem@po.CWRU.Edu (Leonard E. Marinis) wrote:
  15. >.. this is the piece of code that giving me headaches -
  16. >
  17. > /* check it out & process if ICMP_ECHOREPLY */
  18. >        mp=(struct icmphdr *)buff+20;
  19. >        if(!mp->type) {
  20. >                from_host=inet_ntoa(from.sin_addr);
  21. >                host_info=gethostbyaddr((char *)&from.sin_addr, sizeof(from.sin_addr), AF_INET); 
  22. >                printf("\nreply from %s\t", from_host);
  23. >                if(strlen(from_host) < 13)
  24. >                        printf("\t");
  25. >                printf("[%s]", host_info->h_name);
  26. >                
  27. >        } else 
  28. >                printf("\nnon ICMP_ECHOREPLY packet");
  29. >
  30. >the strange thing is, it works fine. until about 80 host replies
  31. >come in - at which time the process segmentation faults
  32. >and quits. if i had any clue about how to analyze a core file, i would.
  33.  
  34. gethostbyaddr() returns NULL on error.
  35.  
  36. HTH,
  37. -- 
  38. Rene Pijlman
  39. R.W.Pijlman@inter.nl.net     http://www.inter.nl.net/users/R.W.Pijlman
  40.